Repository navigation
Require Python 3.11 and modernize CI with Ruff and mypy - #396
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the Python baseline, tooling, and CI modernization.
No open issues 🎉
What changed in this PR
Modernizes PyDrive2’s Python baseline, development tools, and CI independently of the authentication migration in #395.
Changes:
- Require Python 3.11+, test Python 3.11–3.15, and use Python 3.12 for documentation and distribution builds.
- Replace Black and Flake8 with Ruff, add mypy checks, and document the development commands.
- Modernize library code and examples, use standard-library resources, and strengthen parallel-upload verification.
| File | Description |
|---|---|
README.rst |
Document the Python 3.11 minimum. |
pyproject.toml |
Update Python support, dependencies, and Ruff/mypy configuration. |
pydrive2/test/test_util.py |
Flatten results with itertools.chain and modernize formatting. |
pydrive2/test/test_oauth.py |
Sort imports. |
pydrive2/test/test_fs.py |
Modernize imports, comprehensions, and context managers. |
pydrive2/test/test_filelist.py |
Simplify result collection and string formatting. |
pydrive2/test/test_file.py |
Retry incomplete listings, verify uploaded IDs, and use pathlib. |
pydrive2/test/test_drive.py |
Sort imports. |
pydrive2/test/test_apiattr.py |
Sort imports. |
pydrive2/settings.py |
Simplify YAML loader selection and error formatting. |
pydrive2/fs/spec.py |
Add cache type annotations and simplify expressions. |
pydrive2/files.py |
Add typing-compatible guards and simplify existing code. |
pydrive2/drive.py |
Consolidate and sort imports. |
pydrive2/auth.py |
Annotate class variables and modernize error formatting. |
pydrive2/apiattr.py |
Combine equivalent change-detection conditions. |
pydrive2/__pyinstaller/test_hook-googleapiclient.py |
Verify the Drive discovery document using standard-library resources. |
pydrive2/__pyinstaller/hook-googleapiclient.py |
Sort hook imports. |
examples/using_folders.py |
Use f-string output. |
examples/Upload-and-autoconvert-to-Google-Drive-Format-Example/upload.py |
Correct argument validation and modernize exit/query syntax. |
examples/strip_bom_example.py |
Simplify example output formatting. |
docs/conf.py |
Sort imports and remove the obsolete encoding header. |
CONTRIBUTING.rst |
Document tool installation, Ruff, and mypy commands. |
.pre-commit-config.yaml |
Replace Black/Flake8 hooks with Ruff hooks. |
.github/workflows/test.yml |
Expand the Python matrix and add manual execution. |
.github/workflows/publish.yml |
Update actions and build distributions with Python 3.12. |
.github/workflows/pre-commit.yml |
Run Ruff checks and add a mypy job. |
.github/workflows/docs.yml |
Update actions and build documentation with Python 3.12. |
.flake8 |
Remove the superseded Flake8 configuration. |
Review effort: Balanced
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All 15 jobs passed on Python 3.11–3.15 across Ubuntu, macOS, and
Windows. Ruff, mypy, and the docs build passed on the same commit.
Branch test run · Lint and types · Docs build
Changes
standard library in the PyInstaller hook test.
runners. Add a manual trigger so changes to the test workflow can be
verified on the pull request branch. Use Python 3.12 to build docs and
distributions.
defaults and enable import sorting, Python upgrades, typing checks, and
the existing 89-column lint limit. The formatter retains 79 columns.
Ruff infers Python 3.11 from the package metadata. Run mypy on the
library, including unannotated function bodies, for the same minimum.
test now retries incomplete Drive listings and compares the returned IDs
to the IDs of the uploaded files.
This CI change targets main independently of the auth migration in #395.
It supersedes #390 and #397.
The Python minimum is a breaking change for users on 3.8, 3.9, and 3.10.
Verification
Local Ruff checks, formatting, pre-commit hooks, and mypy pass. The Sphinx
docs, wheel, and source distribution build. The frozen PyInstaller app
found Drive's discovery document on Python 3.15.
The automatic PR test workflow reads its matrix from main. Its six failures
are the old 3.9 and 3.10 jobs. Ubuntu 26.04 cannot provision Python 3.9,
and pip rejects the package on the other five jobs because it requires
Python 3.11 or newer. Automatic test run